package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SoilChemTraceMapper;
import com.ruoyi.system.domain.SoilChemTrace;
import com.ruoyi.system.service.ISoilChemTraceService;
import com.ruoyi.common.core.text.Convert;

/**
 * 微量元素Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-20
 */
@Service
public class SoilChemTraceServiceImpl implements ISoilChemTraceService 
{
    @Autowired
    private SoilChemTraceMapper soilChemTraceMapper;

    /**
     * 查询微量元素
     * 
     * @param id 微量元素主键
     * @return 微量元素
     */
    @Override
    public SoilChemTrace selectSoilChemTraceById(Long id)
    {
        return soilChemTraceMapper.selectSoilChemTraceById(id);
    }

    /**
     * 查询微量元素列表
     * 
     * @param soilChemTrace 微量元素
     * @return 微量元素
     */
    @Override
    public List<SoilChemTrace> selectSoilChemTraceList(SoilChemTrace soilChemTrace)
    {
        return soilChemTraceMapper.selectSoilChemTraceList(soilChemTrace);
    }

    /**
     * 新增微量元素
     * 
     * @param soilChemTrace 微量元素
     * @return 结果
     */
    @Override
    public int insertSoilChemTrace(SoilChemTrace soilChemTrace)
    {
        soilChemTrace.setCreateTime(DateUtils.getNowDate());
        return soilChemTraceMapper.insertSoilChemTrace(soilChemTrace);
    }

    /**
     * 修改微量元素
     * 
     * @param soilChemTrace 微量元素
     * @return 结果
     */
    @Override
    public int updateSoilChemTrace(SoilChemTrace soilChemTrace)
    {
        soilChemTrace.setUpdateTime(DateUtils.getNowDate());
        return soilChemTraceMapper.updateSoilChemTrace(soilChemTrace);
    }

    /**
     * 批量删除微量元素
     * 
     * @param ids 需要删除的微量元素主键
     * @return 结果
     */
    @Override
    public int deleteSoilChemTraceByIds(String ids)
    {
        return soilChemTraceMapper.deleteSoilChemTraceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除微量元素信息
     * 
     * @param id 微量元素主键
     * @return 结果
     */
    @Override
    public int deleteSoilChemTraceById(Long id)
    {
        return soilChemTraceMapper.deleteSoilChemTraceById(id);
    }
}
